package com.applications.codemash;

import java.util.List;

import android.os.Bundle;
import android.widget.ListView;

import com.applications.codemash.core.BaseActivity;
import com.applications.codemash.core.Constants;
import com.applications.codemash.core.Session;
import com.applications.codemash.core.eventhandlers.ListViewItemClickListener;
import com.applications.codemash.utility.CustomContext;
import com.applications.codemash.utility.CustomListAdapter;

public class TrackInfo extends BaseActivity
{
	@Override
    public void onCreate(Bundle savedInstanceState)
    {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.track_info);
    	
    	String sessionTrackName = getIntent().getExtras().get(Constants.SESSION_TRACK_INTENT_KEY).toString();
    	setTitle(sessionTrackName + " Track");
    	
    	List<Session> sessionList = CustomContext.getSessionCache().GetSessionsForTrack(sessionTrackName);
    	ListView listView = (ListView)findViewById(R.id.lstTrackSessions);
    	listView.setOnItemClickListener(new ListViewItemClickListener(this));
    	new CustomListAdapter<Session>(sessionList, this, listView);
    }
}
